/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年6月12日
 */
package com.massyframework.beanskin.util.variables;

import java.util.Collection;
import java.util.Map;

/**
 * 字符串变量替换器
 * @author huangkh
 *
 */
public interface StringVariableReplacer {

	/**
	 * 添加变量
	 * <p>
	 * 如果需要多次执行移除操作，请使用{@link #addVariables(Map).
	 * @param name {@link String},变量名
	 * @param value {@link String}, 变量值
	 */
	void addVariable(String name, String value);
	
	/**
	 * 添加变量集合
	 * @param value {@link Map}
	 */
	void addVariables(Map<String, String> value);
	
	/**
	 * 发现并替换变量
	 * @param text {@link String},可能包含变量的字符串
	 * @return {@link String},替换后的值
	 */
	String foundAndReplace(String text);
	
	/**
	 * 移除变量
	 * <p>
	 * 如果需要多次执行移除操作，请使用{@link #removeVariables(Collection).
	 * @param name {@link String}
	 */
	void removeVariable(String name);
	
	/**
	 * 移除变量集合
	 * @param names {@link Collection}
	 */
	void removeVariables(Collection<String> names);
	
	/**
	 * 移除变量集合
	 * @param names {@link String}数组
	 */
	void removeVariables(String... names);
}
